import sys
import traceback
from application import app, manager
from flask_script import Server
import www
from jobs.launcher import runJob

manager.add_command("runserver", Server(host=app.config['SERVER_IP'],
                                        port=app.config["SERVER_PORT"],
                                        use_debugger=True,
                                        use_reloader=True))

# job 入口
manager.add_command("runjob", runJob())

def main():
    manager.run()


if __name__ == '__main__':
    try:
        sys.exit(main())
    except Exception as e:
        traceback.print_exc()